import { messages } from "share/common";
import React from "react";
import { connect } from "react-redux";
import { Menu, Layout } from "antd";
import "styles/supplier-management/airline-config/airline-config.scss";
import AirLineOrderModel from "./tabs/set-order-model";
import AirLineSupplier from "./tabs/set-air-supplier";
import AirLineTravelControl from "./tabs/set-travel-control";
import AirLineRefundChange from "./tabs/set-refund-change";
import AirLineShowView from "./tabs/set-show-view";
import AirLineChangePrice from "./tabs/set-change-price";
import SetNotice from "./tabs/set-notice";
import SetInternational from "./tabs/set-international";

const { Content, Sider } = Layout;
const components = {
  orderModel: AirLineOrderModel,
  airSupplier: AirLineSupplier,
  airTravelControl: AirLineTravelControl,
  refundChange: AirLineRefundChange,
  showView: AirLineShowView,
  changePrice: AirLineChangePrice,
  setNotice: SetNotice,
  international: SetInternational,
};

class AirlineConfig extends React.Component {
  constructor() {
    super();
    this.state = {
      companyOID: "",
      current: "orderModel",
    };
  }
  handClick = (e) => {
    this.setState({
      current: e.key,
    });
  };
  render = () => {
    const { current } = this.state;
    const TabComponent = components[current];
    return (
      <Layout className="airline-config">
        <Sider style={{ background: "#fff", position: "static" }}>
          <Menu
            onClick={this.handClick}
            selectedKeys={[this.state.current]}
            defaultSelectedKeys={["orderModel"]}
            style={{ height: "100%" }}
          >
            <Menu.Item key="orderModel">{messages("supplier-1.key343") /*预订模式*/}</Menu.Item>
            <Menu.Item key="airSupplier">{messages("supplier-1.key344") /*机票服务商*/}</Menu.Item>
            <Menu.Item key="airTravelControl">{messages("supplier-1.key345") /*差标管控*/}</Menu.Item>
            <Menu.Item key="refundChange">{messages("supplier-1.key346") /*退改签*/}</Menu.Item>
            <Menu.Item key="showView">{messages("supplier-1.key347") /*界面显示*/}</Menu.Item>
            <Menu.Item key="changePrice">{messages("supplier-1.key348") /*机票变价*/}</Menu.Item>
            <Menu.Item key="setNotice">{messages("supplier-1.key349") /*消息通知*/}</Menu.Item>
            <Menu.Item key="international">{messages("supplier-1.key350") /*国际机票询价*/}</Menu.Item>
          </Menu>
        </Sider>
        <Content style={{ background: "#fff" }}>
          <TabComponent companyOID={this.props.params.companyOID} companyName={this.props.params.companyName} />
        </Content>
      </Layout>
    );
  };
}

function mapStateToProps() {
  return {};
}

export default connect(mapStateToProps)(AirlineConfig);
